/*
 * This file is part of ksPlatform
 * 
 * Copyright (c) 2014-2015
 * 
 * This file is dual-licensed under the AGPLv3 (http://www.gnu.org/licenses/agpl-3.0.html) 
 * 
 * If you are unsure which license is appropriate for your use, please contact the sales department
 * at 97041437@qq.com.
 */

package cn.com.ksplatform.modules.system.auth.parammanager.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;

import cn.com.ksplatform.base.BaseModel;

/**
 * @ClassName:PlatParamType <br/>
 * @deprecated:TODO. <br/>
 * @Date: 2015年5月25日 上午10:17:59 <br/>
 * 
 * @author Mr.Luoxing
 * @version 1.0
 */
@Entity
@Table(name = "t_sys_parmatype")
public class PlatParamType extends BaseModel {
	@Id
	@GenericGenerator(name = "systemUUID", strategy = "uuid")
	@GeneratedValue(generator = "systemUUID")
	private String id;
	@Column(unique=true,nullable=false)
	private String ecode;

	@ManyToOne(cascade = { CascadeType.PERSIST })
	@JoinColumn(name = "parent_id")
	@JsonIgnore
	private PlatParamType parent_paramtype;

	@OneToMany(mappedBy = "parent_paramtype",cascade = { CascadeType.PERSIST })
	@OrderBy("id")
	private Set<PlatParamType> children = new HashSet<PlatParamType>(0);
	
	@OneToMany(mappedBy = "paramType")
	private Set<PlatParamItem> items = new HashSet<PlatParamItem>(0);
	
	private String ename;

	@Transient
	public String parent_id;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getEcode() {
		return ecode;
	}

	public void setEcode(String ecode) {
		this.ecode = ecode;
	}

	
	public String getEname() {
		return ename;
	}

	public void setEname(String ename) {
		this.ename = ename;
	}

	public PlatParamType getParent_paramtype() {
		return parent_paramtype;
	}

	public void setParent_paramtype(PlatParamType parent_paramtype) {
		this.parent_paramtype = parent_paramtype;
	}

	public Set<PlatParamType> getChildren() {
		return children;
	}

	public void setChildren(Set<PlatParamType> children) {
		this.children = children;
	}

	public Set<PlatParamItem> getItems() {
		return items;
	}

	public void setItems(Set<PlatParamItem> items) {
		this.items = items;
	}

}
